﻿using System.Runtime.InteropServices;
using OdsServer.Common.DataTransfer;

namespace OdsServer.Common.Packet
{
    [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
    public unsafe struct CommandPacket: IBasePacket
    {
        internal PacketHeader header;
        internal DataTransferCommand command;

        public CommandPacket(DataTransferCommand comm)
        {
            this.header.type    = PacketType.CommandPacket;
            this.header.lenght  = sizeof(CommandPacket);
            this.command        = comm;
        }

        public DataTransferCommand GetCommand()
        {
            return this.command;
        }

        public PacketHeader GetHeader()
        {
            return this.header;
        }
    }
}
